<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE xsl:stylesheet SYSTEM "lang://users">

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">	
	
	<xsl:include href="../shortMain.xsl" />
	<xsl:include href="../common/form.xsl" />

	<xsl:template match="/data">
		<html>
		
		<head>
			<title>
				<xsl:value-of select="$pageTitle" />
			</title>
			<xsl:call-template name="meta-head" />
			<link rel="stylesheet" href="{$baseURI}/css/forms.css" type="text/css" media="all" />
			<link rel="stylesheet" href="{$baseURI}/css/registration.css" type="text/css" media="all" />
		</head>
		<body>
		
			<xsl:call-template name="logo" />

			<div id="content">
				<div id="content_inner">
					<xsl:choose>
						<xsl:when test="$method = 'registered'">
							<h1>&labelRegAllOk;</h1>
							<p>&labelRegMessageToConfirm;.</p>
						</xsl:when>
						<xsl:when test="$method = 'welcome'">
							<h1>&labelRegWelcome;</h1>
							<p>&labelRegYuoCanGo1; <a href="{$baseURI}/users/edit_profile">&labelRegYuoCanGo2;</a> &labelRegYuoCanGo3;.</p>
						</xsl:when>						
						<xsl:otherwise>
							<xsl:apply-templates select="response" />
						</xsl:otherwise>
					</xsl:choose>
				</div>
			</div>

		</body>
		</html>
	</xsl:template>
	
	<xsl:template match="response">
		<h1>&labelReg;</h1>
		<p>&labelRegMes1;.<br/>&labelRegMes2;.</p>
		<form action="{$baseURI}/users/registration/save" method="post">
			<xsl:apply-templates select="form/field[@name='login' and @character='latin']" />
			<xsl:apply-templates select="form/field[@name='name' and @character='header']" />
			<xsl:apply-templates select="form/field[@name='password' and @character='header']" />
			<xsl:apply-templates select="form/field[@name='email' and @character='email']" />
			
			<div class="form_field">
				<div class="form_field_label">&labelCaptcha;:</div>
				<div class="form_field_input">
					<img src="{$baseURI}/captcha.php" width="120" height="60" alt="" />
					<br />
					<input style="width:120px;" class="form_input_integer" type="text" name="captcha" />
					<xsl:if test="captcha/error != ''">
						<br /><span class="form_field_error"><xsl:value-of select="captcha/error" /></span>
					</xsl:if>
				</div>
			</div>
			
			<p>
				<input type="submit" value="&labelToRegistrate;" />		
			</p>
		</form>
	</xsl:template>
	
	<xsl:template match="form/field[@name='login' and @character='latin']">
		<div class="form_field">
			<div class="form_field_label">&labelLogin;:</div>
			<div class="form_field_input">
				<input class="form_input_text" type="text" name="data[new][login]">
					<xsl:attribute name="value">
						<xsl:value-of select="value" />
					</xsl:attribute>
				</input>
				<xsl:if test="error != ''">
					<br /><span class="form_field_error"><xsl:value-of select="error" /></span>
				</xsl:if>
				<xsl:if test="help != ''">
					<br /><span class="form_field_help"><xsl:value-of select="help" /></span>
				</xsl:if>
			</div>
		</div>
	</xsl:template>
	
	<xsl:template match="form/field[@name='password' and @character='header']">
		<div class="form_field">
			<div class="form_field_label password_label_wrapper">
				<div class="password_label">&labelPass;:</div>
				<div class="password_label">&labelPassRepeat;:</div>
			</div>
			<div class="form_field_input">
				<div style="clear:both">
					<input class="form_input_text password" type="password" name="data[new][password]" value="" />
					<input class="form_input_text password" type="password" name="repeat_password" value="" />
				</div>
				<xsl:if test="error != ''">
					<br /><span class="form_field_error"><xsl:value-of select="error" /></span>
				</xsl:if>
				<xsl:if test="help != ''">
					<br /><span class="form_field_help"><xsl:value-of select="help" /></span>
				</xsl:if>
			</div>
		</div>
	</xsl:template>
	
	<xsl:template match="form/field[@name='name' and @character='header']">
		<div class="form_field">
			<div class="form_field_label">&labelName;:</div>
			<div class="form_field_input">
				<input class="form_input_text" type="text" name="data[new][name]">
					<xsl:attribute name="value">
						<xsl:value-of select="value" />
					</xsl:attribute>
				</input>
				<xsl:if test="error != ''">
					<br /><span class="form_field_error"><xsl:value-of select="error" /></span>
				</xsl:if>
				<xsl:if test="help != ''">
					<br /><span class="form_field_help"><xsl:value-of select="help" /></span>
				</xsl:if>
			</div>
		</div>
	</xsl:template>
	
	<xsl:template match="form/field[@name='email' and @character='header']">
		<div class="form_field">
			<div class="form_field_label">&labelEMail;:</div>
			<div class="form_field_input">
				<input class="form_input_text" type="text" name="data[new][email]">
					<xsl:attribute name="value">
						<xsl:value-of select="value" />
					</xsl:attribute>
				</input>
				<xsl:if test="error != ''">
					<br /><span class="form_field_error"><xsl:value-of select="error" /></span>
				</xsl:if>
				<xsl:if test="help != ''">
					<br /><span class="form_field_help"><xsl:value-of select="help" /></span>
				</xsl:if>
			</div>
		</div>
	</xsl:template>
	
</xsl:stylesheet>